<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWechatDoctorInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_doctor_infos', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('name');
            $table->string('headimg');
            $table->string('job_title');
            $table->string('dr_type');
            $table->text('resume');
            $table->string('hospital');
            $table->string('section');
            $table->string('ticket');
            $table->integer('wechat_doctor_id')->unsigned()->unique()->index();
            $table->timestamps();

            $table->foreign('wechat_doctor_id')
                  ->references('id')
                  ->on('wechat_doctors')
                  ->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('wechat_doctor_infos');
    }
}
